package lab02.test34;

public class Test34 {
    public static void main(String[] args) {

            String[] arr = new String[]{"apple","grape","banana","pear"};
            String term;

            for (int i = 0 ; i < arr.length ;i ++){
                for (int j  = i + 1 ; j < arr.length ; j ++){

                    //compareToIgnoreCase可以比较两单词的大小
                    if (arr[i].compareToIgnoreCase(arr[j])>0){
                        term=arr[i];
                        arr[i]=arr[j];
                        arr[j]=term;
                    }
                }
            }

            System.out.println("最小值："+arr[0]+"\n"+"最大值："+arr[3]);

            for (String x :arr){
                System.out.println(x);
            }
        }
    }
